<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6"><![endif]-->
<!--[if IE 7 ]><html class="ie ie7"><![endif]-->
<!--[if IE 8 ]><html class="ie ie8"><![endif]-->
<!--[if IE 9 ]><html class="ie ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html><!--<![endif]-->
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="initial-scale=1,minimum-scale=1" />
	<title>活动管理-抽奖信息</title>
	<%@include file="/public/head-tag.jsp" %>
	<style>
	.item-toolbar{padding:5px;}
	.toolbar-title{font-size:14px}
	</style>
</head>
<body>
     <%@include file="/public/header.jsp" %>
    
    <section class="container">
		<c:set var="sidebar" scope="request" value="content"/>
		    <c:set var="navbar" scope="request" value="activity"/>
		    <c:import url="/public/sidebar.jsp"/>
    	<div class="content">
    		<div class="content-top">
    			<h3 class="content-title">
    				 <div class="bread">
    					<a href="/Manager/web/action/listPage">活动管理</a>
    					<span>&gt;</span>
    					<span>抽奖信息</span>
    				</div>
    			</h3>
    				
    		</div>
    		
    		<div class="content-main">
				<section class="content-item" data-template="item/list" id="box">
					<div class="content-item-top">
						<div class="item-toolbar">
							<span class="toolbar-title">${title}</span>
							<div class="fn-right">
                               <a id="exportDoc" href="/Manager/web/lottery/exportExcel?id=${id}&title=${title}" data-href="/Manager/web/lottery/exportExcel?id=${id}&title=${title}" target="_blank" class="btn btn-default btn-medium">导出excel</a>    			  
                            </div>
						</div> 
						<form action="/Manager/web/lottery/exportSearch" method="get" autocomplete="off">
							
							<div class="filter-item">
								<label for="">时间</label>
								<input type="text" class="text text-100" placeholder="开始时间" name="sdate" date-range/>
								<span>至</span>
								<input type="text" class="text text-100" placeholder="结束时间"  name="edate" date-range/>
							</div>
                            <div class="filter-item">
								<label for="">中奖状态</label>
								<select name="status" class="select">
									<option value="">所有</option>
									<option value="1">已中奖</option>
									<option value="0">未中奖</option>
								</select>
							</div>
							<div class="filter-item">
								<input type="hidden" name="page" value="1"/>
								<input type="hidden" name="id"   value="${id}"/>
							</div>
							<div class="filter-item">
								<label for="">搜索</label>
								<input type="submit" class="btn btn-search"  value="搜索" id="search-button"/>
							</div>
						</form>
					</div>
					
					<div class="content-item-block">
							<table class="table">
								<thead>
								<tr>
									<th style="width:10%">中奖时间</th>
									<th style="width:10%">用户UID</th>
									<th style="width:10%">用户名</th>
									<th style="width:10%">手机号</th>
									<th style="width:10%">是否中奖</th>
									<th style="width:10%">奖品ID</th>
									<th style="width:10%">奖品名</th>
									<th style="width:20%">奖品详细信息</th>
								</tr>
								</thead>
								<tbody id="sortable">
									<tr>
										<td class="align-center" colspan="5">
											<div class="loading">加载中...</div>
										</td>
									</tr>
								</tbody>
							</table>
					</div>
					
				</section>
    		</div>
    	</div>
    </section>
    
   <script type="text/template"  id="item/list" note="抽奖信息列表">
		{{if !datalist || datalist.length==0}}
		<tr><td colspan="5">没有记录！</td></tr>
		{{else}}
			{{each datalist as item}}
				<tr>
					<td>
						<p>{{item.t | dateFormat:'yyyy-MM-dd'}} </p>
						<p class="value-note">{{item.t | dateFormat:'HH:mm'}}</p>
					</td>
					<td><p>{{item.uid}}&nbsp;</p> </td>
					<td>{{item.username}}</td>					
					<td>{{item.phone}}</td>
					<td>
                         {{if item.status==1}} <p class="value-note color-red" > 是 </p>
                         {{/if}}
					     {{if item.status==0}} 未中奖
                         {{/if}}
                    </td>
					<td>{{item.prizeid}}</td>
					<td>{{item.prizename}}</td>
					<td>{{item.prizeinfo}}</td>
				</tr>
			{{/each}}
		{{/if}}
    </script>
    
   <script src="/pages/assets/js/libs/LAB/LAB.js"></script>
   <script>
   		var baseUrl="/pages/assets/js/libs/";
   		$LAB.require({
   			baseUrl:baseUrl,
   			scripts:[
   				["artTemplate/artTemplate2.js","artTemplate/artTemplate.helpers.js"],
  				["form/jquery.common.js?v=2015"],
	   			["moment.min.js","jquery-date-range-picker/daterangepicker.css","jquery-date-range-picker/jquery.daterangepicker.js"],
	   			["pager/theme-simple.css","pager/jquery.pager.js"]
   			]
   		},function(){
   			
    		var App={
    			alert : function(){
    				alert(arguments[0]);
    			},
    			initPlugins:function(){
    				
    				template.helper('itemMatch',function(item,headers){
    					var list=[];
    					$.each(headers,function(i,data){
    						list.push({
    							name:data.title,
    							value:item['item0'+i]
    						})
    					})
    					return list;
    				})
    				
    				template.helper('renderAttrList',function(list){
    					return template('item/attrList',{list:list})
    				})
    			},
    			initDatePicker:function(){
    				var $dates=$("[date-range]").dateRangePicker({
						separator : '至',
						getValue: function(){
							return '';
						},
						setValue: function(s,s1,s2){
							return false;
						}
					})
					.on("datepicker-apply",function(e,date){
						$dates.eq(0).val(date.date1.format('yyyy-MM-dd'));
						$dates.eq(1).val(date.date2.format('yyyy-MM-dd'));
						$(this).parents("form:first").submit()
					})
    			},
    			initEvents:function(){
    				
					$("[data-template]").ajaxLoad({
						beforeSubmit:function(){
							var $this=$(this);
							var data=$this.serialize();
							var $exportDoc=$("#exportDoc");
							$exportDoc.attr("href",$exportDoc.data("href")+data);
						}
					});
					
					$("body").on("click","[action]:not(form)",function(){
						var $this=$(this);
						var action=$this.attr("action");
						var data=$this.data("params");
						return false;
					})
    			},
    			init : function(){
					this.initPlugins();
					this.initDatePicker();
					this.initEvents();
    			}
    		}
    		App.init();
   		})
    </script>
    </body>
</html>